% author: Markus Scherer
% input:  img ... image to open
%         sem ... logical matrix describing structure element
% output: opened image
function io = midilate(img, sem)
  % successive application of erode and dilate
  io = midilate(mierode(img, sem), sem);
